import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
} from 'typeorm';

export enum BrowseTypes {
  MEDIA = 'media',
  PRODUCT = 'product',
}

@Entity('tb_browse', {
  comment: '浏览表',
})
export abstract class Browse {
  @PrimaryGeneratedColumn('increment', { comment: '自增主键', unsigned: true })
  id: number;

  @Column({ comment: '用户ID' })
  userId: number;

  @Column({ comment: '资源类型' })
  type: BrowseTypes;

  @Column({ comment: '资源ID' })
  resourceId: number;

  @CreateDateColumn({ comment: '浏览时间' })
  time: Date;
}
